{% extends 'base.html' %}
{% load viewflow %}
{% load tags %}

{% block title %}
{{ header }}
{% endblock %}

{% block main_content %}
<div class="box box-primary">
    <div class="box-body no-padding">
        <table class="table table-bordered ">
            <thead>
                <tr>
                    <th>Details</th>
                    <th>Assigned To</th>
                    <th>Created</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>
                {% for task in tasks %}
                {% get_task_url task as task_url %}
                <tr>
                    <td>
                        {% if task_url %}
                        <a href="{{ task_url }}">
                            {{ task.flow_task.task_title }}
                        </a>
                        {% else %}
                            {{ task.flow_task.task_title }}
                        {% endif %}
                    </td>
                    <td>{{ task.owner|default_if_none:''}}</td>
                    <td>{{ task.created }}</td>
                    <td>{{ task.status }}</td>
                </tr>
                {% empty %}
                <tr>
                    <td colspan=4>You have no tasks</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock main_content %}
